$(function () {

    $('.cur-date').html(function getDateStr() {

        function getDayStr(date) {
            var dayOfWeek = date.getDay()
            var weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
            return weeks[dayOfWeek]
        }

        var curDate = new Date()
        return curDate.getFullYear() + "年" + (curDate.getMonth() + 1) + "月" + curDate.getDate() + "日" + " " + getDayStr(curDate)
    }())

    $("[data-scroll]").on("click", function (i) {
        i.preventDefault();
        var t = $(this).attr("data-scroll")
            , t = $(t).offset().top;
        $("html,body").animate({
            scrollTop: t
        }, 300)
    });

    // 报名说明
    (function () {
        var i = 1, t = !0
        $(".slide-left").on("click", function () {
            t && (i--,
                t = !1,
                $(".slider-content").animate({
                    left: "-" + 1018 * i + "px"
                }, 500, function () {
                    0 === i && ($(".slider-content").css({
                        left: "-5090px"
                    }),
                        i = 5),
                        t = !0
                }),
                $(".note .nav li").eq(i - 1).addClass("active").siblings().removeClass("active"))
        })

        $(".slide-right").on("click", function () {
            t && (5 === i && ($(".slider-content").css({
                left: "-0px"
            }),
                i = 0),
                i++,
                t = !1,
                $(".slider-content").animate({
                    left: "-" + 1018 * i + "px"
                }, 500, function () {
                    t = !0
                }),
                $(".note .nav li").eq(i - 1).addClass("active").siblings().removeClass("active"))
        })

        $(".note .nav li").on("click", function () {
            i = $(this).index() + 1,
                $(".note .nav li").eq(i - 1).addClass("active").siblings().removeClass("active"),
                $(".slider-content").animate({
                    left: "-" + 1018 * i + "px"
                }, 500)
        })

    })()


    $('.form ul li').on('click', function (i) {
        $('.form ul li').removeClass('active')
        $(this).addClass('active')
        var clickIndex = $('.form ul li').index(this)
        $('.form .message div').removeClass('active')
        $('.form .message').children().eq(clickIndex).addClass('active')
    })

    $('.awards .tags>a').on('click', function (e) {
        $(this).addClass('active').siblings().removeClass('active')
        $('.awards .content-bg>p.active').removeClass('active').siblings().addClass('active')
    })
})


